<?php
require 'inc_security.php';
checkAddEdit("edit");

$proid = getValue('proid', 'int', 'POST', 0);
$active = getValue('active', 'int', 'POST', 0);
$hot = getValue('hot', 'int', 'POST', 0);
$mes = getValue('mes', 'str', 'POST', '', 2);
$useid  = getValue('useid', 'int', 'POST', 0);
$mesuseid = 51;
$response['code'] = '0';
if($mes != ''){
    $sql_update = "UPDATE projects SET pro_hot = '".$hot."', pro_active = '".$active."' WHERE projects.pro_id = '".$proid."' LIMIT 1";
    $db_query = new db_execute($sql_update);
    unset($db_query);
    
    $mesform = new generate_form();
    
    $created = time();
    $status = 1;
        
    $mesform->addTable('user_mes');
    $mesform->removeHTML(0);
    $mesform->add('use_id', 'useid', 1, 1, $useid);
    $mesform->add('mes_use_id', 'mesuseid', 1, 1, $mesuseid);
    $mesform->add('mes_body', 'mesbody', 0, 1, $mes);
    $mesform->add('mes_created', 'created', 1, 1, $created);
    $mesform->add('mes_status', 'status', 1, 1, $status);
    $db_ex = new db_execute($mesform->generate_insert_SQL());
    unset($db_ex);
        
    $response['code'] = '1';
    $response['url'] = 'listing.php';
}
print json_encode($response);
exit;
?>